package com.zkthink.ceres.common.enums;

import com.zkthink.exception.BizException;
import lombok.Getter;

/**
 * @ClassName RedSourceTypeEnum
 * @Description: RedSourceTypeEnum
 * @Author ck
 * @Date 2021/11/24
 * @Version V1.0
 **/
@Getter
public enum RedSourceTypeEnum {
    /**
     * 添加类目时，注意检查接口:findPlateFiancialStatistics
     */
    ADMINAUTO_SOURCE(0, "平台自动发送红包"),
    ADMINHAND_SOURCE(1, "平台手动发送红包"),
    BUYREAD_SOURCE(2, "充值小红心"),
    BUYVIP_SOURCE(3, "充值vip,赠送小红心"),
    BUYVIP_REFFER(4, "被推荐人充值vip,推荐人获得小红心"),
    REGISTER_REFFER(5, "被推荐人注册,推荐人获得小红心"),
    WITHDRAW_GIFTS(6, "一般客户提现减去小心"),
    WITHDRAWFAIL_GIFTS(7, "提现失败退还小红心"),
    RECEIVE_GIFTS(10, "接收其他用户赠送的礼物"),
    GIVE_GIFTS(11, "赠送给其他用户的礼物"),
    LIVE_TICKET(12, "直播间用户花费的门票"),
    LIVE_MASTERTICKET(13, "直播间开启者得到的门票"),
    LIVE_GIFT(14, "直播间用户送出的礼物"),
    LIVE_MASTERGIFT(15, "直播间开启者得到的礼物"),
    BUY_GOOD(16, "购买商品扣除小红心"),
    BUY_VIP(17, "购买VIP扣除小红心"),
    ADMIN_MSG_RED_HEART(18, "回复消息系统发放小红心"),
    CALL_DEDUCTION(19, "视频/语音通话扣费"),
    CALL_CHARGE(20, "视频/语音通话收费"),
    LIVE_ONREAD(21, "直播间连麦扣除小红心"),
    BUY_LOVE_DICTIONARY_ADD(22, "用户购买恋爱宝典文章获得"),
    LOVE_DICTIONARY_REWARD(24, "发布恋爱宝典奖励"),
    BUY_LOVE_DICTIONARY_SUB(23, "用户购买恋爱宝典文章扣除");
    private int code;

    private String desc;

    RedSourceTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static RedSourceTypeEnum getDscByType(Integer type) {
        for (RedSourceTypeEnum p : values()) {
            if (p.getCode() == type.intValue()) {
                return p;
            }
        }
        throw new BizException("no support promotionPlan");
    }
}
